<template>
  <div :id="id" style="width: 100%; height: 100%"></div>
</template>

<script setup>
import { onMounted } from 'vue'
import PDFObject from 'pdfobject'
import { nanoid } from 'nanoid'
import { message as Message } from 'ant-design-vue'
let props = defineProps({
  path: {
    required: true,
  },
})

let id = 'id' + nanoid()
onMounted(() => {
  try {
    PDFObject.embed(props.path, `#${id}`)
  } catch (e) {
    Message.error('渲染失败')
  }
})
</script>

<style scoped lang="less"></style>
